<?php
/**
 * Created by PhpStorm.
 * User: tengwei
 * Date: 2018/11/16
 * Time: 10:17 AM
 */

namespace common\sources\write\businesstaskcommodlog;

use common\models\craftsman\BusinessTaskCommodLog;

class BusinessTaskCommodLogAccess implements IBusinessTaskCommodLogAccess
{
    public function AddTaskRemark($data) {
        $result = BusinessTaskCommodLog::findOne(['id' => $data['id']]);
        if ($result) {
            $result->remark = $data['remark'];
            if ($result->save()) {
                return true;
            }
        }
        return false;
    }

    public function AddTaskLog($data) {
        $log = new BusinessTaskCommodLog();
        $log->bus_id = $data['bus_id'];
        $log->task_status = $data['task_status'];
        $log->status_remark = $data['status_remark'];
        $log->remark = $data['reason'];
        $log->operator = $data['operator'];
        $log->task_id = $data['task_id'];
        $log->create_time = time();
        $log->save();
    }
}